package pers.mingshan.executor;

import java.util.concurrent.Callable;

/**
 * @author hanjuntao
 * @date 2025/6/20 0020
 */
public class Test {
    public static void main(String[] args) {
        MyFutureTask<String> myFutureTask = new MyFutureTask<>(new Callable<String>() {
            @Override
            public String call() {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                return "hello world";
            }
        });

        System.out.println("start: " + System.currentTimeMillis());
        new Thread(myFutureTask).start();

        System.out.println("start-get: " + System.currentTimeMillis());
        System.out.println(myFutureTask.get());
        System.out.println("end-get: " + System.currentTimeMillis());
    }
}
